package com.hot.controller;

import com.hot.constants.Constants;
import com.hot.pojo.Hotevents;
import com.hot.service.HoteventsService;
import com.hot.utils.PageUtil;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.annotation.Resource;

/**
 * @Title
 * @Author 寻冬忆敏
 * @Date 2022/4/30 21:29
 * @Description
 */
@Controller
public class HoteventsController {

    @Resource
    private HoteventsService hoteventsService;

    @GetMapping("/list")
    public String hoteventsList(@RequestParam(required = false, defaultValue = "1") Integer pageIndex, Model model, @RequestParam(required = false) String keyWord) {
        PageUtil<Hotevents> pageUtil = hoteventsService.getHoteventsPageList(pageIndex, Constants.PAGESIZE, keyWord);
        model.addAttribute("pageUtil", pageUtil);
        return "index";
    }
}
